<!DOCTYPE html>
<html class="um landscape min-width-240px min-width-320px min-width-480px min-width-768px min-width-1024px">
    <head>
        <title></title>
        <meta charset="utf-8">
        <meta name="viewport" content="target-densitydpi=device-dpi, width=device-width, initial-scale=1, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0">
        <link rel="stylesheet" href="css/fonts/font-awesome.min.css">
        <link rel="stylesheet" href="css/ui-base.css">
        <link rel="stylesheet" href="css/ui-box.css">
        <link rel="stylesheet" href="css/project/style.css">
         <link rel="stylesheet" href="css/zv_common.css">
        <style>
    .zv_noticebo{border-bottom:1px solid #e5e5e5;}
    .zv_noticefont1{height:2.2em;line-height:2.2em;color:#fe0202;font-size:0.925em; overflow:hidden;white-space:nowrap; text-overflow:ellipsis;}
    .zv_noticefont2{ height:2.2em;line-height:2.2em;color:#a3a3a3;}
    .zv_noticefont3{height:2.2em;line-height:2.2em;color:#a3a3a3; font-size:0.925em;width:6em;white-space:nowrap; overflow:hidden;  }
    .zv_noticefont5{ height:1.2em;line-height:1.2em;color:#a3a3a3;font-size:0.925em;}
        /*tab切换样式*/
    .uinn-hnfn2{
        padding:0.78em 0;
    }
    /*
 以上样式同notice-content.html样式
*/
    .zv_noticefont4{height:2em;line-height:2em;color:#000;white-space:nowrap; overflow:hidden; text-overflow:ellipsis; font-weight:bolder;font-size:0.85em;}
    </style>
    </head>
    <body class="um-vp" ontouchstart style="-webkit-tap-highlight-color: rgba(0, 0, 0, 0);">
        <div id="page_2">
            <div id="time_0" style="width:6em"></div>
            <div id="big">
            </div>
        </div>
        <input type="hidden" id="pageNum1" value="1">
        <input type="hidden" id="pageNum2" value="1">
    </body>
        <script src="js/appcan.js"></script>
        <script src="js/appcan.control.js"></script>
        <script src="js/talkingdata.js"></script>
        <script src="js/common.js"></script>
    </body>
    <script>
        appcan.ready(function() {
             IC.talkingDataCount("必读通知","0203"); 
             required();
            // uexWindow.onNotification = required();
        })
               
        //显示必读列表
        function required(){
            IC.talkingDataCount("必读通知","0203"); 
            //var url="http://172.31.64.34:8011/sdk10098/public/QBMessage/DFReadContentCount";
             var username = localStorage['MU30-lOGIN-USRNAME'];
           // username="chengcheng1";
            var url= h_yddfUrl+"yddfMAS/h_portalUserDutyWebService";
            console.log(url+"?userName="+username)
            $.ajax({
                url:url+"?userName="+username,
                dataType:"json",
                type:"GET",
                success:function(data){
                            appcan.window.closeToast();
                            console.log(data.queryUserDutys);
                            var obj=JSON.parse(data.queryUserDutys);
                            var w = document.body.offsetWidth;
                            var zv_noticefont3w = document.getElementById("time_0").offsetWidth;
                            var titleW = w-zv_noticefont3w;
                            //obj = strToJson(obj);
                            var objdata = obj.userDutys;
                            var strx = "";  
                            for(var i=0;i<objdata.length;i++)   
                             {      
                                    var CreateDate = objdata[i].createTime.time;
                                    var at = new Date(CreateDate);
                                    var year  = String(at.getFullYear());   
                                    var month  = String(at.getMonth()+1);
                                    var date  = String(at.getDate()); 
                                    if(month<10)
                                    {
                                        month=0+''+month
                                    }
                                    if(date<10)
                                    {
                                        date=0+''+date
                                    }
                                    CreateDate=year+'/'+month+'/'+date
                                    var sdk="11345717";
                                    var name=objdata[i].dutyType;
                                    var paperId="";
                                    if(name=="考试"){
                                        paperId=objdata[i].url.split("=");
                                        paperId=paperId[2];
                                    }
                                    if(name=="必读通知"){
                                         strx += '<div class="ub uinn umh2 zv_noticebo" ontouchstart="zy_touch(\'zvbtn-act\')" style=" z-index:1" onclick=cuccten("'+objdata[i].dutyId+'")>'
                                        strx += '<div class="ub-f2  ub ub-ver">'
                                        strx += '<div class=" zv_noticefont1" style="width:'+titleW+'px">'+objdata[i].dutyName+'</div>'
                                        strx += '</div>'
                                        strx += '<div id="time_'+i+'" class="ub-f1  tx-r  ulev-1 zv_noticefont3">'+CreateDate+'</div>'
                                        strx += '</div>'
                                    }
                             }    
                             $("#big").html(strx); 
                             if(strx==""){
                                 $("#big").html("<div style='width:100%;text-align:center;padding:2em 0;font-size:.9em;'>暂无数据</div>"); 
                             }
                        },error:function(err){
                            appcan.window.closeToast();
                            console.log(JSON.stringify(err));
                        }
                      })
                    }
                    //http://172.31.64.34:8011/sdk10098/public/QBMessage/DFReadContentCount?userName=chengcheng1   //测试mas接口
                    //跳转展示数据页面。
                    function cuccten(id){
                       IC.talkingDataCount("必读通知","0203"); 
                        //IC.talkingDataCount("必读通知详情","0060");
                        // var url="http://172.31.68.234:8080/portal/ws/content/detail/";
                        //url="http://172.31.64.34:8011/sdk10098/public/QBMessage/DFReadSpecifics?id=";
                        url=h_yddfUrl+"yddfMAS/queryContentById?contentId=";
                        $.ajax({
                            url:url+id,
                            dataType:"json",
                            type:"GET",
                            success:function(data){
                                delcommission("必读通知",id);
                               // console.log(JSON.stringify(data));
                                appcan.window.open({
                                        name:'requiredxq',
                                        dataType:0,
                                        data:'requiredxq.html'
                                });
                                 localStorage.setItem("requiredxq",data.queryContentById);
                            },error:function(err){
                                //console.log(JSON.stringify(err));
                            }
                        })
                    }
                     function delcommission(dutyTpe,dutyId){
                         IC.talkingDataCount("必读通知","0203"); 
                          console.log(dutyTpe+dutyId);
                          var dutyTpe="必读通知";
                          var username = localStorage['MU30-lOGIN-USRNAME'];
                         // username="chengcheng1";
                          var url=h_yddfUrl+"yddfMAS/h_doFinishDuty?userName="+username+"&dutyId="+dutyId+"&dutyTpe="+dutyTpe;
                          $.ajax({
                              url:url,
                              type:"GET",
                              dataType:"json",
                              success:function(data){
                                  // console.log(data);
                                  //alert(JSON.stringify(data));
                                  required();
                              },error:function(err){
                                 // console.log(err);
                              }
                          })
                     }
    </script>
</html>